#!/bin/bash
#date: 2017-12-5
#author: sujunquan
#des: redhat7.x 安装aliyum yum源脚本

#1.删除redhat系统yum包
rpm -qa |grep yum |xargs rpm -e --nodeps

#2.删除redhat系统python-urlgrabber包
rpm -qa|grep python-urlgrabber|xargs rpm -e --nodeps

#3.安装
rpm -ivh *.rpm --nodeps

#4.拷贝CentOS-Base.repo文件到/etc/yum.repos.d/
mkdir /tmp/repobackup
mv /etc/yum.repos.d/* /tmp/repobackup
cp CentOS-Base.repo /etc/yum.repos.d/

#5.删除yum cache
rpm -rf /var/cache/yum

#6.更新yum源
yum clean all
yum makecache

#7.愉快地使用aliyun yum源吧
yum update -y
